package ch04;

/**
 * Created by 其 on 2016/3/20.
 */
import java.util.Scanner;

public class Fibonacci{
    public static void main(String[] args){
        System.out.printf("求几个费氏数？");
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        if(n == 1)
            System.out.print(0);
        else{
            long[] fiboNums = new long[n];
            fiboNums[1] = 1;
            System.out.print(0 + " " + 1);
            for(int i=2; i<n; i++){
                fiboNums[i] = fiboNums[i-2] + fiboNums[i-1];
                System.out.print(" " + fiboNums[i]);
            }
        }
        System.out.println();
	/*
		fiboNums[1] = 1;
		for(int i=2; i<n; i++){
			fiboNums[i] = fiboNums[i-2] + fiboNums[i-1];
		}
		for(int fiboNum : fiboNums){
			System.out.print(fiboNum + " ");
		}
		System.out.println();
	*/
    }

}
